package com.xiaoshuidi.cloud.module.contract.service.contract;

import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.module.contract.controller.admin.bill.vo.SettlementOrderFeeVO;
import com.xiaoshuidi.cloud.module.contract.controller.admin.bill.vo.rentOrder.RentOrderCountVO;
import com.xiaoshuidi.cloud.module.contract.controller.admin.contract.vo.company.BatchSettlementOrderFeeVO;
import com.xiaoshuidi.cloud.module.contract.controller.admin.contract.vo.company.CompanyContractRefundReqVO;
import com.xiaoshuidi.cloud.module.contract.controller.admin.contract.vo.settlement.*;
import com.xiaoshuidi.cloud.module.contract.dal.dataobject.contract.SettlementDO;
import com.xiaoshuidi.cloud.module.contract.dal.dataobject.contract.SettlementDetailDO;
import com.xiaoshuidi.cloud.module.contract.dal.dataobject.contract.SettlementExtDO;
import com.xiaoshuidi.cloud.module.finance.api.order.dto.PayOrderCreateReqDTO;

import java.time.LocalDate;
import java.util.List;

/**
 * 合同结算Service
 */
public interface ContractSettlementService {
    /**
     * 合同截至到某一日期需要结算的费用
     *
     * @param contractId
     * @param endDate
     */
    List<SettlementOrderFeeVO> settlement(Long contractId, LocalDate endDate, String settlementType);

    /**
     * 创建合同结算
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    SettlementDO createSettlement( SettlementCreateReqVO createReqVO);

    /**
     * 获取合同结算清单
     *
     * @param contractId 合同id
     * @return
     */
    ContractSettlementListReqVO getSettlementByContractId(Long contractId);


    /**
     * 获取合同结算单（带全部清单）
     * @param contractId
     * @return: com.xiaoshuidi.cloud.module.contract.controller.admin.contract.vo.settlement.ContractSettlementWithDetailRespVO
     */
    ContractSettlementWithDetailRespVO getSettlementWithDetailByContractId(Long contractId);

    /**
     * 添加查询清算单列表
     *
     * @param reqVO
     * @return
     */
    PageResult<ContractSettlementGetListRespVO> getSettlementList(ContractSettlementGetListReqVO reqVO);

    /**
     * @param reqVO
     * @return
     */
    PageResult<ContractSettlementGetListRespVO> getSettlementCompanyBatchList(ContractSettlementGetListReqVO reqVO);

    /**
     * 通过合同id获取企业合同退租清单列表
     *
     * @param reqVO
     * @return
     */
    PageResult<ContractSettlementCompanyListRespVO> getSettlementCompanyList(ContractSettlementGetListReqVO reqVO);

    /**
     * 通过id查看企业退租清单
     * @param id 清算单id
     * @return
     */
    ContractSettlementCompanyListReqVO getSettlementCompany(Long id);
    /**
     * 通过id编辑企业退租清单编辑
     * @param id 清算单id
     * @return
     */
    CompanyContractRefundReqVO getSettlementCompanyCompile(Long id);
    /**
     * 通过清算单id获取企业合同退租清单列表
     * @param id
     * @return
     */
    ContractSettlementListReqVO getSettlementById(Long id);

    /**
     * 确认清算
     *
     * @param reqVO
     */
    void settlementConfirm(SettlementReqVO reqVO);

    /**
     * 单个企业批量清算
     *
     * @param reqVO
     */
    void settlementCompanyBatchConfirm(SettlementReqVO reqVO);

    void settlementConfirmList(List<Long> reqVO);

    void settlementCompanyBatchConfirmList(List<Long> reqVO);

    Long inflowLiquidation(PayOrderCreateReqDTO reqVO);

    /**
     * 企业确认清算
     *
     * @param reqVO
     */
    void companySettlementConfirm(SettlementReqVO reqVO);

    /**
     * 结算单打印pdf
     *
     * @param reqVO
     * @return
     */
    List<SettlementExtDO> getSettlementPdfList(List<String> reqVO);

    List<SettlementExtDO> getSettlementCompanyPdfList(List<String> reqVO);

    List<SettlementDetailDO> getSettlementDetail(Long id);

    /**
     * 修改结算单状态
     * @param id 清算单id
     * @param status 清算单状态
     */
    void updateStatus(Long id, String status);

    Long getSettlementCount();

    RentOrderCountVO getSettlementDetailCount(Long id);

    List<ContractSettlementExcelVO> exportSettlementExcel(ContractSettlementReqExcelVO req);

    List<ContractSettlementExcelVO> exportSettlemenCompanyBatchtExcel(ContractSettlementReqExcelVO req);

    ContractSettlementListReqVO getSettlementByProcessInstanceId(String id);

    BatchSettlementOrderFeeVO batchSettlement(List<Long> ids, LocalDate endTime, String settlementType);

    /**
     * 获取清算子项
     *
     * @param id
     * @return
     */
    List<SettlementDO> getSettlementSubitemByParentId(Long id);
}
